Class_name = "CTurret"
object_name = "_M4A2_T1"

AimingRay=true

[COCKPIT_LIMITS]
x= -0.07, 0.07
y= -0.2, 0.1
z= -0.07, 0.07
[END]

[OPEN_COCKPIT_LIMITS]
x= -0.5, 0.5
y= -0.03, 0.25
z= -0.5, 0.5
[END]

VisualImage=0,"graphics\Vehicles\_M4A2\_M4A2-C2-low.mgm",true
VisualImage=1,"graphics\Vehicles\_M4A2\_M4A2-C2.mgm",8
CollisionBody="graphics\Vehicles\_M4A2\_M4A2-C2.col"
HitBody="graphics\Vehicles\_M4A2\_M4A2-C2_DetColl.col"
KeepNetworkImages=true	//high-poly cockpit will be visible from other workstations of the object

//VisualImage=ID,model_or_effect,cast_shadows[,debris_effects]
//ID:					INT:	0 - visible everywhere, 1 - visible inside, 2 - visible outside
//model_or_effect:		STRING:	path to model file (mgm) of effect file (epl)
//cast_shadows: 		BOOL/INT:	cast shadows from object or not (cast_shadows=Attr1+Attr2+...+AttrN)
//						VIF_CASTSHADOWS=1,
//						VIF_BLENDMASKLAST=2,
//						VIF_ALWAYSONTOP=4,
//						VIF_FLATAMBIENT=8,
//[,debris_effects]:	BOOL:	optional parameter, show effects on object debris or not

ImageAttr=1	//IA_NOCLIP
//	IA_DEFAULT=0,
//	IA_NOCLIP=1,
//	IA_NOCLIP_ANIM=2,
//	IA_NOROTINTERPOLATION=4,
//	IA_NOMINZ=8,
//	IA_NOMINPIXELS=16,
//	IA_NOPOSINTERPOLATION=32,
//	IA_CLOSEVIEWARG=64,
//	IA_ALWAYSVISIBLE=128,
//	IA_SCALEARG=256,
//	ImageAttr=Attr1+Attr2+...+AttrN

TransparentCockpit=false	// If false - Attached bot will be not rendered if cockpit hatch is closed (default =true)

//LocalPosRot=true
//ConvexAnimThreshold=0.000001	//  

VisualRadius=5.0

mp_site=true

CopyPosAttachID=1	//Copy orientation from other parent's object, on AttachID==1

TurretType = 12	//    ,    (, )
//11 -  
//12 -  
//13 -  

[attach=0]
	object = "LuaScripts/WorldObjects/Bots/BotTankM4A2_Commander.txt"
	position = 0,0,0
	convex="bot_pos",false	//false: Attach object relative to "bot_pos" convex (not absolute)
[end]

[attach=1]
	position = 0.0, 0.0, 0.0
	object = "LuaScripts/WorldObjects/TurretRiffle.txt"
[end]

[attach=2]
	position = 0.0, 0.0, 0.0
	object = "LuaScripts/WorldObjects/TurretCameraTank.txt"
[end]

TargetingScript = "LuaScripts/WorldObjects/Ballistics/Projectiles/BULLET_RUS_7-62x54_AP.bin"

SoundScript="LuaScripts/Sound/Vehicles/M4A2_FP_Turret_T1.cfg"

Script="LuaScripts\ObjectScripts\Vehicles\_M4A2_T1.sc"

//FetchArgVal= cockpit_arg_num, transfer_number, default_cockpit_arg_val, interpolation_type (clamp - shortest on line scale, wrap - shortest on cyclic scale)


[TurretsPos=0]
	position = -0.36462, 0.78006, 0.45612
	PosMoveArg = 21000
	SeatArg=22111
	SeatUpTime=1.0
	SeatDownTime=1.0
	defaultturretpos = true
	IdlePos = true

	ReloadDelay = 0.3
	BotRotaionValueZ = 0.0	//-2.0
	LegsParameter = 0.0
	BotMinFirstAngle  = -90
	BotMaxFirstAngle  = 90
	BotMinSecondAngle = -90
	BotMaxSecondAngle = 90
	FirstToSecondInterp = 0.0

	LockTurretCamera=false

	// Joints in orientation order!!!

	[Joint=0]
		SectorAngleMin = -180.0
		SectorAngleMax = 180.0

		AngularSpeed   = 30.0

		AnimationArgMin = 0.0
		AnimationArgMax = 1.0

		AnimationArgNum = 21001

		Point = 0.45034,0.15535,-0.00034
		Axis = 0.0,1.0,0.0

		IsCycled = true
		NextLinkedId = 1

		SoundNumber = 1
	[end]

	[Joint=1]
		SectorAngleMin = -20.0
		SectorAngleMax = 20.0
		
		AngularSpeed   = 120.0

		AnimationArgMin = 0.388889
		AnimationArgMax = 0.611111

		AnimationArgNum = 21006

		Point = -0.04236,0.223,0.04541
		Axis  = 0.0,1.0,0.0

		DependFromPrevious = true
		PrevLinkedId = 0

		SoundNumber = 2
	[end]

	[Joint=2]
		SectorAngleMin = -47.0
		SectorAngleMax = 30.0
		
		AngularSpeed = 120.0
		
		AnimationArgMin = 0.238889
		AnimationArgMax = 0.666667

		AnimationArgNum = 21002
		PrevLinkedId = 1
		
		Point = 0,0,0
		Axis  = 0.0, 0.0, 1.0

		SoundNumber = 2

		NoMoveFar=true	// Block rotation when the target is in the rear henisphere
	[end]

	[GunAnimation=0]
		FireArg = 60320
	[end]

//	FireLightArg=60220

	relativeBotStand = 0.0, 0.0, 0.0 // not used for tank
	relativeBotSit = 0.0, 0.0, 0.0 // not used for tank
	relativeBotDead = 0.0, 0.0, 0.0 // not used for tank
	TransitionStandPower = 1 // not used for tank
	TransitionDeadPower = 1 // not used for tank

	BotAttachJointId = 0
	BotFirstAnimJointId = 2
	BotSecondAnimJointId  = 1

	SightPosition = 0.0, 1, 0.0

	defaultDirection = 1.0, 0.0, 0.0
	AimSector=-180, 180, -30, 47	//AI aim limits: left, right, down, up

	CamDisplacement = -0.4701,0.09016,-0.04574
[end]

[TurretsPos=1]
	position = -0.36462, 0.78006, 0.45612
	PosMoveArg = 21000
	SeatArg=22111
	SeatUpTime=1.0
	SeatDownTime=1.0
	defaultturretpos = false
	IdlePos = false

	ReloadDelay = 0.3
	BotRotaionValueZ = 0.0	//-2.0
	LegsParameter = 0.0
	BotMinFirstAngle  = -90
	BotMaxFirstAngle  = 90
	BotMinSecondAngle = -90
	BotMaxSecondAngle = 90
	FirstToSecondInterp = 0.0

	LockTurretCamera=false

	// Joints in orientation order!!!

	[Joint=0]
		SectorAngleMin = -180.0
		SectorAngleMax = 180.0

		AngularSpeed   = 30.0

		AnimationArgMin = 0.0
		AnimationArgMax = 1.0

		AnimationArgNum = 21001

		Point = 0.45034,0.15535,-0.00034
		Axis = 0.0,1.0,0.0

		IsCycled = true
		NextLinkedId = 1

		SoundNumber = 1
	[end]

	[Joint=1]
		SectorAngleMin = -20.0
		SectorAngleMax = 20.0
		
		AngularSpeed   = 120.0

		AnimationArgMin = 0.388889
		AnimationArgMax = 0.611111

		AnimationArgNum = 21006

		Point = -0.16856,0.11136,0.04541
		Axis  = 0.0,1.0,0.0

		DependFromPrevious = true
		PrevLinkedId = 0

		SoundNumber = 2
	[end]

	[Joint=2]
		SectorAngleMin = -75.0
		SectorAngleMax = -35.0
		
		AngularSpeed = 120.0
		
		AnimationArgMin = 0.083333
		AnimationArgMax = 0.305556

		AnimationArgNum = 21002
		PrevLinkedId = 1
		
		Point = 0,0,0
		Axis  = 0.0, 0.0, 1.0

		SoundNumber = 2
	[end]

	[GunAnimation=0]
		FireArg = 60320
	[end]

//	FireLightArg=60220

	relativeBotStand = 0.0, 0.0, 0.0 // not used for tank
	relativeBotSit = 0.0, 0.0, 0.0 // not used for tank
	relativeBotDead = 0.0, 0.0, 0.0 // not used for tank
	TransitionStandPower = 1 // not used for tank
	TransitionDeadPower = 1 // not used for tank

	BotAttachJointId = 0
	BotFirstAnimJointId = 2
	BotSecondAnimJointId  = 1

	SightPosition = 0.0, 1, 0.0

	defaultDirection = 1.0, 0.0, 0.0
	AimSector=-180, 180, 35, 75	//AI aim limits: left, right, down, up

	CamDisplacement = -0.4701,0.09016,-0.04574
[end]

[TurretsGun=0]
	LinkedTurretPos = 0,1
	//Convex = "#mg2"
	DGroup="MachineGun"
	DamageProp = 0.001

	Displacement = 1.06845,-0.11354,-0.04574
	GunsightPosition =  -0.4701,0.09016,-0.04574
	GunType = "LuaScripts/WorldObjects/Weapons/_M2-50_45in.txt"
	ParallaxDistance = 1000000.0

	ReLoadingStagesTime = 1.0, 3.0, 1.0, 0.3

	ReservedMagazinesArgIdx = 9008
//	FlashAnimationArgIdx = 60320
	TriggerPositionArgIdx = 9001
	RoundsInMagazineArgIdx = 9009
	AmmunitionMovingArgIdx = 9005
	HideAmmunitionArgIdx = 9010
	ReLoadingArgIdx = 9011
	AzimuthDeviationArgIdx = 9006
	ElevationDeviationArgIdx = 9007
//	FiringPinPositionArgIdx = 0			// not used
	DrawAnimationArgIdx = 0, 9004		//  
	DrawAnimationArgIdx = 2, 9003		// 
	DrawAnimationArgIdx = 3, 9002		//  

	Deviation = 0.67, 2.1, 0.0, 0.01, 0.03, 0.06  //0.8333   , 3.3333   ,    .  840/
	// /:
	//-      , /
	//-      , /
	//-       (0.9 -    0.1  ,   )
	//-    
	//-     
	//-      100/

	NumOfAnimations = 4

	BushCoord = -0.06436,-0.07301,-0.04574
	BushSpeed = -1, -1, 0

	BushConfig = "LuaScripts/WorldObjects/Trash/Batch_case12-20mm.txt"

	SoundNumber = 3
[end]

[Ammunition0]
	GunAmmunition0=0
[end]
[GunAmmunition0]
	MaxRoundsInMagazine = 50
	RoundsInMagazine = 50
	MaxReservedMagazines = 5
	ReservedMagazines = 5
	MaxMisFiresInMagazine = 0
	AmountRoundsWithOneTracer = 4
	ParallaxConfig="LuaScripts/WorldObjects/Ballistics/Projectiles/BULLET_USA_12-7x99_AP_895ms.bin"
	BulletConfig = "LuaScripts/WorldObjects/Ballistics/Projectiles/BULLET_USA_12-7x99_AP.txt"
[end]

SightPos = 0.0, 1.3, 0.0
PositionChangeTime = 0.5
StandDuration = 1.0
SitDuration = 1.0
PreEjectDuration = 1.0
ReloadDelay = 0.3
FreezeOnReload = false
AutoRecharge = false

BotRotaionValueZ = 0	// not used for tank
LegsParameter = 0 // not used for tank

BotMaxSecondAngle = 25.0 // not used for tank
BotMinSecondAngle = -5.0 // not used for tank

BotMaxFirstAngle  = 10.0 // not used for tank
BotMinFirstAngle  = -10.0  // not used for tank

FirstToSecondInterp = 0.0 // not used for tank

GunSightDistanceArg = 9544
GunSightYawArg = 9546
GunSightTypeArg = 9545

//   ,         
SectorLimits =  -140.0,  +45.0,  -20.0, 90.0
//SectorLimits =	-180.0, -140.0, -15.0, 90.0
//SectorLimits =	 140.0,  180.0, -15.0, 90.0

// Damage

//BeamHitZeroArmor=true //      m_fArmor  m_fArmorSides ( ,       )
//LifeRate=5000
//LifeRateFrag=5000 
//Firing=0.005
//Armor=66
//[ArmorBox]			//    ,     ,   ,     Armor=
//	FovH=90			//          ,     ,  ArmorFront
//	FovV=90			//          ,     ,  ArmorFront
//					//  5        
//	ArmorFront=86
//	ArmorBack=66
//	ArmorTop=30
//	ArmorBottom=30
//	ArmorRight=66
//	ArmorLeft=66
//[end]

//maxDamageArgValue=0.98
//DamageArg=5000
damageablePart=""

IsCritical=false	//true -       
LifeK=200			//         ( -  )

KillChildObjectsOnParentDeath = true

SphereHitProtection=41	//       

[SphereProtectionBoxOpen]	//    ,        ,   ,     SphereHitProtection=
	FovH=90			//          ,     ,  ArmorFront
	FovV=90			//          ,     ,  ArmorFront
					//  5        
	ArmorFront=0
	ArmorBack=0
	ArmorTop=0
	ArmorBottom=20
	ArmorRight=0
	ArmorLeft=0
[end]

[SphereProtectionBoxClose]	//    ,        ,   ,     SphereHitProtection=
	FovH=90			//          ,     ,  ArmorFront
	FovV=150			//          ,     ,  ArmorFront
					//  5        
	ArmorFront=70
	ArmorBack=41
	ArmorTop=19
	ArmorBottom=20
	ArmorRight=41
	ArmorLeft=41
[end]

////	Energy loss for bullet travel through HitBody convices	////

energyloss="",true,1,200	//     , true -       -,       ,        
energyloss="#mg2",true,5,20000				//Machinegun
energyloss="#ammobox",true,2,20000			//Ammo box
energyloss="com_tower_1",false,20,20000		//Commander tower armouring, 25mm, K=0.8
energyloss="com_tower_2",false,20,20000		//Commander tower armouring, 25mm, K=0.8
energyloss="com_tower_3",false,20,20000		//Commander tower armouring, 25mm, K=0.8
energyloss="com_tower_4",false,20,20000		//Commander tower armouring, 25mm, K=0.8
energyloss="com_tower_5",false,20,20000		//Commander tower armouring, 25mm, K=0.8
energyloss="com_tower_6",false,20,20000		//Commander tower armouring, 25mm, K=0.8

//Damageable parts
energyloss="#turret1003a_coll",false,0,1		//Dummy collision for visual damage, mask, part 2
energyloss="sight_1056",false,1,1			//Commander visor glass

/////Functional Damage Groups

[DGroup=MachineGun]
	IsCritical=false
	LifeK=20
	convex="#mg2",5,10000,"MT_ARMOR"
	[SphereHitArmorBox]
		FovH=170
		FovV=90
		ArmorFront=5
		ArmorBack=5
		ArmorTop=5
		ArmorBottom=30
		ArmorRight=5
		ArmorLeft=5
	[end]
	LifeRateFrag=5000
	RepairSpeed=0.002083	// (8 )
	RepairSource=0
	InstantRepair=true
[end]
[DGroup=Body]		//   _KV1s.txt     DGroup
	IsCritical=true
	LifeK=200
	DamageArg=5000
	MinValidLife=0.02
[end]

//End of Functional Damage Groups
//Graphical Damage Groups:

[DGroup=CornerComTwr]
	IsCritical=false
	LifeK=50
	convex="#turret1003a_coll",10,20000,"MT_ARMOR"
	SphereHitProtection=10			//   -      
	[SphereHitArmorBox]		//    ,        ,   ,     SphereHitProtection=
		FovH=90	
		FovV=90				//          ,     ,  ArmorFront
							//  5        
		ArmorFront=10
		ArmorBack=10
		ArmorTop=10
		ArmorBottom=80
		ArmorRight=10
		ArmorLeft=10
	[end]
	LifeRateFrag=20000
	Shield=0.0
	DamageArg=1003
	DamageMaxVal=0.98
	SmokeArg=0
	SmokeDec=0.02
	RepairSpeed=0.008333	// (2 ,    "" =4   0.5 )
	RepairSource=4			//     ""
	InstantRepair=false
[end]
[DGroup=Visor1]
	IsCritical=false
	LifeK=2	
	convex="sight_1056",1,500,"MT_ARMOR"
	SphereHitProtection=8		//   -      
	[SphereHitArmorBox]			//    ,        ,   ,     SphereHitProtection=
		FovH=60		
		FovV=20					//          ,     ,  ArmorFront
								//  5        
		ArmorFront=1
		ArmorBack=8
		ArmorTop=8
		ArmorBottom=30
		ArmorRight=8
		ArmorLeft=8
	[end]
	LifeRateFrag=5000
	Shield=0.0
	DamageArg=1056
	DamageMaxVal=1.0
	SmokeArg=0
	SmokeDec=0.02
	RepairSpeed=0.033333	// (0.5 )
	RepairSource=0
	InstantRepair=true
[end]

//End of Graphical Damage Groups

[Entrance]
	EntrancePos= -1.0, -0.94, 3.5
	EntranceRot= 0,135,0
	JumpDir= 0,0,0
[end]

ColimatorHideArg=9547

//DefaultGun=0	//default=-1, all of the guns are active, switching belts in gun 0. >=0 sets default gun and switshing will be between guns

ClosedHatch=false				// True -    
ClosedWindow=true				// True -    
CanopyOpenByDefault=false
WindowOpenByDefault=false
NoAimingWhenOpened=false		// True -      
NoAimingWhenClosed=true			// True -      
DenyDisabledTurretCamera=true	// True -         
canopytime=5.9375	//   Arg=0  Arg=0.95.     Arg=0.1  Arg=0.9     (5 ),    0.95/0.8*5=5.9375.
windowtime=1.5

OpenCockpitArg=31
AutoCanopy=false
CockpitLightArg=30000,0.35,0.351,0.6
canopyLockSoundMask=2 	// 0 bit - canopy unlock, start
						// 1 bit - canopy unlock, end
						// 2 bit - canopy lock, start
						// 3 bit - canopy lock, end

//OpenWindowArg=33
AutoWindow=false
WindowLightArg=30010,0.3,0.45,0.6

TechChatCrewRole=5	//    (Driver: 1, Gunner: 3, Commander: 5, Machinegunner: 7, Radioman: 9)

SetCockpitArgs=true	// true -             , false -              

//CockpitArg= FetchType, CmdID, SubcmdID, ArgNum, ArgValDefault, SmoothingType, SmoothingPower, NetworkFlag
//FetchType=-1:       
//FetchType=-2:         
//FetchType=-3:          parent-
//FetchType>=0:          child-   Attach ID
//CmdID=[0..999]: ID    ,    .
//CmdID=[1000..1999]: ID    ,    .
//SubcmdID=[0..3]: ID     .
//SubcmdID=[0..1]: ID     .
//ArgNum:     / .
//ArgValDefault:      ,    .
//SmoothingType: smooth_clamp -  - 
//SmoothingType: smooth_wrap -   
//SmoothingPower:   
//NetworkFlag="":           ,  SetCockpitArgs=false
//NetworkFlag="low_freq":     ,       ,    
//NetworkFlag="med_freq":     ,       ,    
//NetworkFlag="high_freq":     ,       ,    
//NetworkFlag="granted_single":     ,       ,     

CockpitArg = -3, 0000, 0, 60210, 0.0, "smooth_clamp", 0.0, ""			// Electric point lights
CockpitArg = -3, 0000, 1, 60310, 0.0, "smooth_clamp", 0.0, ""			// Electric flood light
CockpitArg = -3, 0050, 0, 6050, 0.5, "smooth_wrap", 0.5, ""				// Radio device animation

CockpitArg = -2, 0100, 0, 9008, 0.0, "", 0.0, "granted_single"			// ReservedMagazinesArgIdx

CockpitArg = -2, 0150, 0, 9001, 0.0, "smooth_clamp", 0.1, "med_freq"	// TriggerPositionArgIdx, gun1
CockpitArg = -2, 0150, 1, 9009, 0.0, "smooth_wrap", 0.1, "med_freq"		// RoundsInMagazineArgIdx, gun1
CockpitArg = -2, 0150, 2, 9010, 0.0, "", 0.0, "med_freq"				// HideAmmunitionArgIdx, gun1
CockpitArg = -2, 0150, 3, 9011, 0.0, "smooth_wrap", 0.1, "med_freq"		// ReLoadingArgIdx, gun1

VisorYawMin=-180
VisorYawArgMin=0.0
VisorYawMax=+180
VisorYawArgMax=1.0
VisorYawArg=40
VisorYawDefault=0
VisorYawSpeed=0.5
VisorPitchMin=-35
VisorPitchArgMin=0.305556
VisorPitchMax=+15
VisorPitchArgMax=0.583333
VisorPitchDefault=0
VisorPitchArg=35
VisorPitchSpeed=0.25
VisorResetWhileAim=true
VisorResetIfOpened=true
PrecisionAngle=2	//Rotation stop smoothing

[moveBotDeviator]
  HiFreqAmp = 0.2f
  MaxDeviation = 0.3f
  Periods = 2.1, 0.4;
[end]
accelBotDirK = 0.25
accelBotDirSmooth = 0.04
accelBotSideK = 0.25
accelBotSideSmooth = 0.04